package day04.ext;

import java.lang.reflect.Array;
import java.lang.reflect.Field;

public class Demo07 {
    public static void main(String[] args) throws Exception {
        String s1 = "ABC";
        String s = new String("ABC");

        System.out.println(s1);
        System.out.println(s);

        Class cls = String.class;
        Field field = cls.getDeclaredField("value");
        field.setAccessible(true);
        Object charArr = field.get(s1);
        Array.set(charArr, 0, 'X');

        System.out.println(s1);
        System.out.println(s);


    }
}
